﻿using QD.LopPlat.UI.Model;
using QD.LopPlat.UI.Model.Sys;
using QD.SQLHelper;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data.Entity;
using System.Data.Entity.ModelConfiguration.Conventions;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace QD.LopPlat.UI.Code.DbContent
{
    /// <summary>
    /// 组织数据库
    /// </summary>
    public class DbQfDevPlat : EFDbContext
    {
        public DbQfDevPlat()
            : base(DbConfig.Instance.GetDbDataBaseConnStr())
        {
            //禁用EF中实体表不存在时自动创建功能
            Database.SetInitializer<DbQfDevPlat>(null);
        }

        public DbSet<QDDataBase> QDDataBase { get; set; }
        public DbSet<QD.LopPlat.UI.Model.Sys.License> License { get; set; }

        public DbSet<QDConfig> QDConfig { get; set; }
        public DbSet<Sys_UidPwd> Sys_UidPwd { get; set; }
        public DbSet<Sys_UidRefQf> Sys_UidRefQf { get; set; }
        public DbSet<Sys_UidRoleRel> Sys_UidRoleRel { get; set; }

        public DbSet<Sys_Message> Sys_Message { get; set; }
        

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            //关闭EF访问表时自动在表名后面加S
            modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
        }
    }
}
